package com.ruoyi.industryfrontend.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.core.web.page.TableDataList;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.industryfrontend.domain.SpaceIndustry;
import com.ruoyi.industryfrontend.service.ISpaceIndustryService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 首页Controller
 *
 * @author MagicCube
 * @date 2023-05-08
 */
@RestController
@RequestMapping("/homepage")
public class HomePageController extends BaseController {

    @Autowired
    private ISpaceIndustryService spaceIndustryService;

    /**
     * 综合列表
     * @param spaceIndustry 产业信息
     * @return 综合产业列表
     */
    @GetMapping("/list")
    public TableDataInfo list(SpaceIndustry spaceIndustry){
        startPage();
        List<SpaceIndustry> spaceIndustries = spaceIndustryService.selectSpaceIndustryListz(spaceIndustry,false);
        return getDataTable(spaceIndustries);
    }
    @GetMapping("/spaceList")
    public TableDataList spaceList(SpaceIndustry spaceIndustry){
        startPage();
        List<SpaceIndustry> spaceIndustries = spaceIndustryService.selectSpaceIndustryListz(spaceIndustry,false);
        return getDataList(spaceIndustries);
    }

    /**
     * 人气最高
     * @param spaceIndustry 产业信息
     * @return 结果
     */
    @GetMapping("/popularList")
    public TableDataInfo popularList(SpaceIndustry spaceIndustry){
        startPage();
        List<SpaceIndustry> spaceIndustries = spaceIndustryService.selectSpaceIndustryPopularList(spaceIndustry,false);
        return getDataTable(spaceIndustries);
    }
    /**
     * 最新上架
     * @param spaceIndustry 产业信息
     * @return 结果
     */
    @GetMapping("/newlyAddedList")
    public TableDataInfo newlyAddedList(SpaceIndustry spaceIndustry){
        startPage();
        List<SpaceIndustry> spaceIndustries = spaceIndustryService.selectSpaceIndustryNewlyAddedList(spaceIndustry,false);
        return getDataTable(spaceIndustries);
    }

}
